<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('出库单列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>出库单号：</label>
                            <input type="text" name="orderId"/>
                        </li>
                        <li>
                            <label>领用单位：</label>
                            <input type="text" name="department"/>
                        </li>
                        <li>
                            <label>领用工段：</label>
                            <input type="text" name="section"/>
                        </li>
                        <li>
                            <label>出库时间：</label>
                            <input type="text" class="time-input" placeholder="请选择出库时间" name="outboundTime"/>
                        </li>
                        <li>
                            <label>审批人：</label>
                            <input type="text" name="approver"/>
                        </li>
                        <li>
                            <label>领料人：</label>
                            <input type="text" name="picker"/>
                        </li>
                        <li>
                            <label>仓管员：</label>
                            <input type="text" name="warehouseKeeper"/>
                        </li>
                        <li>
                            <label>备注：</label>
                            <input type="text" name="mark"/>
                        </li>
                        <li>
                            <label>物料编码：</label>
                            <input type="text" name="materialId"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="warehouse:deliveryOrder:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()"
               shiro:hasPermission="warehouse:deliveryOrder:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('warehouse:deliveryOrder:edit')}]];
    var removeFlag = [[${@permission.hasPermi('warehouse:deliveryOrder:remove')}]];
    var prefix = ctx + "warehouse/deliveryOrder";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            exportUrl: prefix + "/export",
            modalName: "出库单",
            detailView: true,
            onExpandRow: function (index, row, $detail) {
                initChildTable(index, row, $detail);
            },
            columns: [{
                checkbox: true
            }, {
                field: 'id',
                title: '主键',
                visible: false
            }, {
                field: 'orderId',
                title: '出库单号'
            }, {
                field: 'department',
                title: '领用单位'
            }, {
                field: 'section',
                title: '领用工段'
            }, {
                field: 'deliveryType',
                title: '出库类别'
            }, {
                field: 'outboundTime',
                title: '出库时间'
            }, {
                field: 'approver',
                title: '审批人'
            }, {
                field: 'picker',
                title: '领料人'
            }, {
                field: 'warehouseKeeper',
                title: '仓管员'
            }, {
                field: 'mark',
                title: '备注'
            }]
        };
        $.table.init(options);
    });

    initChildTable = function (index, row, $detail) {
        var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
        $(childTable).bootstrapTable({
            url: prefix + "/detailList/" + row.orderId,
            method: 'get',
            sidePagination: "server",
            columns: [{
                field: 'materialId',
                title: '物料编号'
            }, {
                field: 'materialName',
                title: '物料名称'
            }, {
                field: 'quantity',
                title: '出库数量'
            }, {
                field: 'unitPrice',
                title: '单价'
            }, {
                field: 'unit',
                title: '物料单位'
            }, {
                field: 'producer',
                title: '产地'
            }, {
                field: 'brand',
                title: '品牌'
            }, {
                field: 'supplierName',
                title: '供应商'
            }]
        });
    };
</script>
</body>
</html>